home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 5
/
Gold Medal Software - Volume 5 (Gold Medal) (1995).iso
/
music
/
pbcdk10.arj
/
ACDKIT.ZIP
/
ACDKIT.BAS
next >
Wrap
BASIC Source File
|
1994-10-15
|
4KB
|
154 lines
DEFINT A-Z
$DYNAMIC
$INCLUDE "ACDKIT.BI" ' If you get an error on these lines, then
$LINK "ACDKIT.PBL" ' you did not start PowerBASIC from the
' directory where ACDKIT.BAS is installed.
DECLARE FUNCTION TimeStr$ (BYVAL mins%, BYVAL secs%)
DECLARE SUB UpdateDisplay ()
%FALSE = 0
%TRUE = NOT %FALSE
DIM tracklist(0) AS SHARED trackinfo ' music track information array
DIM cd AS SHARED cdInfoTYPE ' track info
DIM cddrive AS SHARED INTEGER ' first cdrom drive
DIM curTrack AS SHARED INTEGER ' current track number
DIM keypress AS SHARED STRING
curTrack = 1
IF IsMSCDEX = %FALSE THEN
CLS: PRINT "MSCDEX.EXE driver is not installed."
END
END IF
cddrive = GetFirstCDROM% ' get the first cdrom drive
cdMediaChanged cddrive% ' clear changed flag
RESTART:
CLS
IF IsAudio(cddrive) = %FALSE THEN ' is this an audio cd?
PRINT "The inserted cd is not an audio cd."
PRINT "Please insert an audio cd and restart."
END
END IF
cdInit cddrive%, tracklist() ' read cd information
IF (cd.status AND %CDPLAYING) <> %CDPLAYING THEN
cdSeek cddrive%, 1, tracklist() ' seek to first song
END IF
PRINT "┌────────────────────────────────────┐"
PRINT "│ AUDIO CD TOOLKIT │"
PRINT "├────────────────────┬───────┬───────┤"
PRINT "│ Audio Track(s) │ │ │"
PRINT "├────────────────────┼───────┼───────┤"
PRINT "│ Current Audio Time │ │ │"
PRINT "├────────────────────┼───────┼───────┤"
PRINT "│ Total Audio Time │ │ │"
PRINT "├────────────────────┴───────┴───────┤"
PRINT "│ P Play Audio Track │"
PRINT "│ S Stop Audio Playback │"
PRINT "│ SPACE Pause/Resume Audio Track │"
PRINT "│ + Next Audio Track │"
PRINT "│ - Previous Audio Track │"
PRINT "│ TAB Open/Close CD-ROM Door │"
PRINT "│ ESC End │"
PRINT "└────────────────────────────────────┘"
DO
LOCATE 19, 1
IF (cd.status AND %CDPAUSED) = %CDPAUSED THEN
PRINT "PAUSED "
ELSEIF (cd.status AND %CDPLAYING) = %CDPLAYING THEN
PRINT "PLAYING"
ELSE
PRINT " "
END IF
keypress$ = UCASE$(INKEY$)
SELECT CASE keypress$
CASE CHR$(27)
END
CASE "P"
cdPlay cddrive%, curTrack, 99, tracklist()
CASE "S"
cdStop cddrive%
CASE " "
IF (cd.status AND %CDPAUSED) = %CDPAUSED THEN
cdResume cddrive%
ELSE
cdPause cddrive%
END IF
CASE "+"
curTrack = curTrack MOD UBOUND(trackList) + 1
cdPlay cddrive%, curTrack, 99, tracklist()
CASE "-"
curTrack = curTrack - 1
IF curTrack = 0 THEN
curTrack = UBOUND(trackList)
END IF
cdPlay cddrive%, curTrack, 99, tracklist()
CASE CHR$(9)
IF (cd.status AND %CDOPEN) = %CDOPEN THEN
cdDoor cddrive%, 2
ELSE
cdStop cddrive%
cdDoor cddrive%, 1
END IF
CASE ELSE
cdGetInfo cddrive%, 0, cd, tracklist()
UpdateDisplay
END SELECT
LOOP
END
FUNCTION TimeStr$ (BYVAL mins AS INTEGER, BYVAL secs AS INTEGER)
DIM text AS STRING
IF secs% = 254 then ' compensate for cd-rom seconds error
secs% = 0
END IF
text$ = USING$("##", mins%) + ":" + USING$("##", secs%)
REPLACE " " WITH "0" IN text$
TimeStr$ = text$
END FUNCTION
SUB UpdateDisplay
LOCATE 4, 33: PRINT UBOUND(trackList)
LOCATE 8, 32: PRINT TimeStr$(cd.cdMins, cd.cdSecs)
LOCATE 4, 25: PRINT USING$("##", cd.track)
LOCATE 6, 32: PRINT TimeStr$(cd.cdMin, cd.cdSec)
LOCATE 6, 24: PRINT TimeStr$(cd.TrackMin, cd.TrackSec)
LOCATE 8, 24: PRINT TimeStr$(cd.TrackMins, cd.TrackSecs)
END SUB